//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections.Generic;
using System.Text;
using OpenLS.Core;

namespace OpenLS.Spreadsheet
{
    class TableRemovedUndoUnit: TableUndoUnit
    {
        #region IUndoUnit Members

        public TableRemovedUndoUnit(Worksheet worksheet, Table table) : base(worksheet, table)
        {
        }

        public override void Do()
        {
            Table newTable = worksheet.AddTable(table.Range, table.Style, table.Name, table.Comment, table.IsPublic, table.IsReadOnly, table.AllowsUpdate, table.AllowsDelete, table.AllowsInsert);
            newTable.AutoFilter = table.AutoFilter;
            newTable.DisplayName = table.DisplayName;
            newTable.ColumnStripesVisible = table.ColumnStripesVisible;
            newTable.FirstColumnVisible = table.FirstColumnVisible;
            newTable.LastColumnVisible = table.LastColumnVisible;
            newTable.RowStripesVisible = table.RowStripesVisible;
        }

        #endregion
    }
}
